/*
 * @lc app=leetcode.cn id=125 lang=cpp
 *
 * [125] 验证回文串
 */

// @lc code=start
class Solution {
public:
    bool isPalindrome(string s) {
        transform(s.begin(),s.end(),s.begin(),::toupper);
        for(int i = 0; i < s.length(); i++)
        {
            if(s[i] >= 'A' && s[i] <= 'Z')
                continue;
            if(s[i] >= '0' && s[i] <= '9')
                continue;
            s.erase(i, 1);
            i--;
        }
        for(int i = 0, j = s.size() - 1; i < j; i++, j--)
        {
            if(s[i] != s[j])
                return false;
        }
        return true;
    }
};
// @lc code=end

